/*****************************************************************************
 * Copyright (C) Stacy Curl. All rights reserved.                            *
 * ------------------------------------------------------------------------- *
 * The software in this package is published under the terms of the BSD      *
 * style license a copy of which has been included with this distribution in *
 * the LICENSE.txt file.                                                     *
 *****************************************************************************/
package picounit.features.coverage_measuring.mutator;

import picounit.features.classloader.mutator.DefaultClassMutator;
import picounit.features.coverage_measuring.CoverageConfiguration;

public class CoverageClassMutator extends DefaultClassMutator implements CoverageConfiguration {
	private final CoverageState coverageState;
	
	public CoverageClassMutator(CoverageListener coverageListener, IdSource idSource,
		CoverageState coverageState) {

		super(new CoverageMethodMutator(coverageListener, idSource));

		this.coverageState = coverageState;
	}

	@Override
	public boolean shouldMutate(String className) {
		return coverageState.isCoverageEnabled();
	}

	///////////////////////////////////////////////////////////////////////////////////////////////
	// CoverageConfiguration methods
	///////////////////////////////////////////////////////////////////////////////////////////////

	public void disableCoverage() {
		coverageState.disableCoverage();
	}

	public void enableCoverage() {
		coverageState.enableCoverage();
	}
}